<template>
		<view class="grace-body">
			<form @submit="formSubmit" class="grace-form grace-margin-top">
			   <view class="grace-items">
					<view class="grace-label">昵称</view>
					<input type="text" class="input" name="nickname" placeholder="请输入昵称" />
				</view>
				<view style="padding:22rpx 0;">
					<button formType="submit" type="primary" style="width:100%;">保存</button>
				</view>
			</form>
		</view>
</template>

<script>
	// var graceChecker = require("../../../graceUI/jsTools/graceChecker.js");
    import  graceChecker from "../../../graceUI/jsTools/graceChecker.js"
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			formSubmit : function(e){
						//定义表单规则
						var rule = [
							{name:"nickname", checkType : "string", checkRule:"1,10",  errorMsg:"姓名应为1-10个字符"},
						];
						//进行表单检查
						var formData = e.detail.value;
						var checkRes = graceChecker.check(formData, rule);
						if(checkRes){
							uni.showToast({title:"验证通过!", icon:"none"});
						}else{
							uni.showToast({ title: graceChecker.error, icon: "none" });
						}
				}
		},
		components:{
			graceChecker
		}
	}
</script>

<style>

</style>
